package com.gitee.srurl.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gitee.srurl.core.domain.SusVisitorRecordDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

/**
 * @author zxw
 * @date 2023/4/29 17:23
 */
@Mapper
public interface SusVisitorRecordMapper extends BaseMapper<SusVisitorRecordDomain> {

    /**
     * 查询不同的IP数量
     *
     * @param startDate 查询开始时间
     * @param endDate   查询结束时间
     * @return 不同的IP数量
     */
    @Select("select COUNT(DISTINCT(ip)) FROM sus_visitor_record WHERE visit_time BETWEEN #{startDate} AND #{endDate} ")
    Long countDistinctIp(Date startDate, Date endDate);
}
